package com.itheima.stock.controller;

import com.itheima.stock.service.UserService;
import com.itheima.stock.vo.req.LoginReqVo;
import com.itheima.stock.vo.resp.LoginRespVo;
import com.itheima.stock.vo.resp.R;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.Map;

@RestController
//前端有 跨域请求配置 "/api"
@RequestMapping("/api")
public class UserController {
//    @GetMapping("/test")
//    public String getName(){
//        return  "itheima";
//    }
    @Autowired
     private UserService userService;
    @PostMapping("/login")
    public R<LoginRespVo> login(@RequestBody LoginReqVo vo){
        return userService.login(vo);
    }

    @GetMapping("/captcha")
    public R<Map>  generateCaptcha(){
        return userService.generateCaptcha();
    }
}
